package com.janj.service;

import com.janj.bean.Student;
import com.janj.dao.OneToOneMapper;
import com.janj.util.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

public class OneToOneServiceImpl implements OneToOneService {
   // @Test
    @Override
    public List<Student> selectOneToOne() {
        //1.获取操作对象  session
        SqlSession session = MyBatisUtils.getSqlSession();

        //2.获取代理对象  mapper
        OneToOneMapper mapper = session.getMapper(OneToOneMapper.class);

        //3.执行SQL语句
        List<Student> array =  mapper.selectOneToOne();
        //System.out.println("array = " + array);
        //4.释放资源
        MyBatisUtils.close();
        return array;

    }
}
